import Vue from 'vue'
import App from './App.vue'
import router from './routers/index';
import '@/assets/style/resets.css';
import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/style/global.css';
import store from './vuex/store';
import moment from 'moment';
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css'

import 'quill/dist/quill.snow.css'

import 'quill/dist/quill.bubble.css'
import BreadCrumb from './components/commons/BreadCrumb.vue'

Vue.prototype.$moment = moment;

const originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originPush.call(this, location, onResolve, onReject)
  return originPush.call(this, location).catch(err => err);
}

const originReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location, onResolve, onReject) {
  if (onResolve || onReject) return originReplace.call(this, location, onResolve, onReject)
  return originReplace.call(this, location).catch(err => err);
}

import VueRouter from "vue-router";
// 引入echarts图表
import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts
Vue.use(VueQuillEditor) // 注册富文本编辑器

// 按需引入 element-ui
import { Container, Header, Aside, Main, Menu, Submenu, MenuItem, Form, FormItem, Input, Button, MenuItemGroup, Row, Col, DatePicker, Radio, Table, TableColumn, Image, Pagination } from 'element-ui';

Vue.component('BreadCrumb', BreadCrumb);
Vue.config.productionTip = false
// 进行全局注册
Vue.use(Container);
Vue.component(Header.name, Header);
Vue.use(Aside);
Vue.use(Main);
Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Button);
Vue.use(Row);
Vue.use(Col);
Vue.use(DatePicker);
Vue.use(Radio);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Image);
Vue.use(Pagination);
new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')